<template>
	<view>
		<u-tabbar
		    :value="current"
		    @change="handleChangeTabbar"
		    inactiveColor="#b8bab7"
		    :activeColor="primaryColor"
		    zIndex="99"
		>
		  <u-tabbar-item v-for="(item,index) in tabbarList" :key="index" :text="item.text">
		    <image
		        class="u-page__item__slot-icon"
		        slot="active-icon"
		        :src="item.selectedIconPath"
		    ></image>
		    <image
		        class="u-page__item__slot-icon"
		        slot="inactive-icon"
		        :src="item.iconPath"
		    ></image>
		  </u-tabbar-item>
		</u-tabbar>
		<e-register-popup ref="registerPopup"></e-register-popup>
	</view>
</template>
<script>
let app = getApp();
export default {
  name: "e-tabbar",
  props:{
    current: {
      type: Number | String,
      default: 0
    }
  },
  data() {
    return {
			primaryColor: "#333",
      tabbarList:[
        {
          "pagePath": "/pages/index/index",
          "iconPath": "/static/tabbar/index.png",
          "selectedIconPath": "/static/tabbar/index-active.png",
          "text": "AI占卜"
        }, {
          "pagePath": "/pages/ai/ai",
          "iconPath": "/static/tabbar/ai.png",
          "selectedIconPath": "/static/tabbar/ai-active.png",
          "text": "智能体"
        }, {
          "pagePath": "/pages/augur/augur",
          "iconPath": "/static/tabbar/bazi.png",
          "selectedIconPath": "/static/tabbar/bazi-active.png",
          "text": "八字排盘"
        },  {
          "pagePath": "/pages/mine/mine",
          "iconPath": "/static/tabbar/mine.png",
          "selectedIconPath": "/static/tabbar/mine-active.png",
          "text": "我的"
        }
      ],
    }
  },
  mounted() {
    uni.hideTabBar();
  },
  methods: {
    handleChangeTabbar(e) {
      console.log(e);
			// if(!app.isCompleteInfo()){
			// 	// 完善个人信息弹窗
			// 	this.$refs.registerPopup.handleShowPopup();
			// 	return;
			// };
      this.$emit('hide',);
      setTimeout(() => {
        uni.switchTab({
          url: this.tabbarList[e].pagePath,
        })
      },20)
    }
  }
}
</script>

<style scoped lang="scss">
.u-tabbar{
  /deep/ &__content{
    z-index: 999999 !important;
  }
}
  .u-page__item__slot-icon{
    width: 24px;
    height: 24px;
  }
</style>